# Contributor: Gennady Feldman <gena01@gmail.com>
# Maintainer: Gennady Feldman <gena01@gmail.com>
pkgname=php7-pecl-rdkafka
_pkgreal=rdkafka
pkgver=4.0.3
pkgrel=1
pkgdesc="A librdkafka bindings for PHP7 providing a working client for Kafka 0.8-0.10"
url="https://pecl.php.net/package/$_pkgreal"
arch="all"
license="MIT"
makedepends="php7-dev autoconf file librdkafka-dev pcre-dev re2c"
# https://pecl.php.net/get/$_pkgreal-$pkgver.tgz does not include the tests
source="$_pkgreal-$pkgver.tgz::https://github.com/arnaud-lb/php-rdkafka/archive/$pkgver.tar.gz"
builddir="$srcdir/php-$_pkgreal-$pkgver"

provides="php7-rdkafka=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-rdkafka" # for backward compatibility

build() {
	phpize7
	./configure --prefix=/usr --with-php-config=/usr/bin/php-config7
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test
}

package() {
	make INSTALL_ROOT="$pkgdir"/ install
	install -d "$pkgdir"/etc/php7/conf.d
	echo "extension=$_pkgreal.so" > "$pkgdir"/etc/php7/conf.d/$_pkgreal.ini
}

sha512sums="f570108bc45405b2634d787324e239b39dedc1459107e13c862b66ade15e52c24ae89722ee9f3bcc76c32915c5a6f0bf8e6ad8c0b9d397ebdfb3edb79867e4af  rdkafka-4.0.3.tgz"
